/*
 * Wiener.h
 *
 *  Created on: Nov 26, 2011
 *      Author: igor
 */

#ifndef WIENER_H_
#define WIENER_H_

#include <iostream>
class Wiener
{
public:

	typedef struct
	{
		int N;
		int e;
	} PublicKey;

	typedef struct
	{
		int p;
		int q;
		int d;
	} PrivateKey;

	typedef struct
	{
		int d;
		int phi;
		int q;
		int p;
		bool succeded;
	} Result;
private:
	PublicKey m_rsaKey;

	long m_nK;
	Result m_result;

private:
	void calculate();
	bool check(const int& k, const int& d);
public:
	Wiener();
	~Wiener(void);
public:
	Result attack(PublicKey& key);
};

#endif /* WIENER_H_ */
